package com.itheima.TestMethod;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Demo {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
        Class<?> clazz = Class.forName("com.itheima.TestMethod.Student");

        Method method = clazz.getDeclaredMethod("setName1", String.class);

        Student stu  = (Student) clazz.newInstance();

        Object o = method.invoke(stu,"lisi");

        System.out.println(o);


    }
}
